package com.pro.service.imple;

import com.pro.mapper.CouponMapper;
import com.pro.pojo.Coupon;
import com.pro.service.CouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * auther 杨沛琪
 * createDate 2022/1/11
 */
@Service
public class CouponServiceImple implements CouponService {
    @Autowired
    private CouponMapper couponMapper;
    //获取所有优惠券
    @Override
    public List<Coupon> getTable() {
        return couponMapper.getTable();
    }
    //根据条件搜索优惠券
    @Override
    public List<Coupon> queryCoupon(String couponName, Integer grant, Integer online) {
        return couponMapper.queryCoupon(couponName, grant, online);
    }
    //删除当前点击的优惠券
    @Override
    public boolean delCoupon(Integer couponId) {
        return couponMapper.delCoupon(couponId);
    }
    //查看当前点击的优惠券详情
    @Override
    public List<Coupon> couponDetails(Integer couponId) {
        return couponMapper.couponDetails(couponId);
    }
    //添加优惠券
    @Override
    public boolean addCoupon(Coupon coupon) {
        return couponMapper.addCoupon(coupon);
    }
    //根据优惠券名称查询优惠券
    @Override
    public List<Coupon> queryCouponByName(String couponName) {
        return couponMapper.queryCouponByName(couponName);
    }
    //根据id修改优惠券
    @Override
    public Boolean updateUserCoupon(Coupon coupon) {
        return couponMapper.updateUserCoupon(coupon);
    }
}
